Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Fix Elastica\Document undefined method #1476

Closed

Conversation

lowki
Copy link

@lowki lowki commented Jun 17, 2020

Fix undefined method call to Elastic\Document::setType() in ElasticaFormatter Class.

@Seldaek
Copy link
Owner

Seldaek commented Jul 8, 2020

setType used to exist, but not anymore perhaps.. Are you sure setOpType is the equivalent? The type we use by default is record which doesn't seem to be a valid optype.. /cc @thePanz @stof if anyone can provide input on supporting newer versions of Elsatica here that'd be great.

@Seldaek Seldaek added this to the 1.x milestone Jul 8, 2020
@Seldaek Seldaek added the Bug label Jul 8, 2020
@thePanz
Copy link

thePanz commented Jul 8, 2020

Elasticsearch types have been deprecated in v6.x and removed from v7.x.

The proper way to upgrade to the new ES is to completely remove the type, the rule is "one index, one document type (_doc)".
I suggest to remove all references to the type (not just the line changed in this PR).

This would be a BC break; do not forget to fix the dependency to the right version of the ruflin/elastica library :)

@dsism
Copy link

dsism commented Aug 25, 2020

any news on this setType() issue?
I'm having the same problem after upgrade Elastica to 7 :(

@dakorpar
Copy link

dakorpar commented Dec 1, 2020

same here

@thePanz
Copy link

thePanz commented Dec 2, 2020

Anybody would support me to have a testing environment up and running to fix this? I can save some time next week to work on this issue

@@ -72,7 +72,7 @@ protected function getDocument(array $record): Document
{
$document = new Document();
$document->setData($record);
$document->setType($this->type);
$document->setOpType($this->type);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The opType is the operation type and not at all the same as types in ES<7. See https://github.com/ruflin/Elastica/blob/b1b6c980cce2ffc3f278e0d3d02e61b174cee52e/src/AbstractUpdateAction.php#L186

@Seldaek
Copy link
Owner

Seldaek commented Dec 14, 2020

Fixed by #1523

@Seldaek Seldaek closed this Dec 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants